package fi.foyt.cs.api.json;

import java.util.Locale;

import org.json.JSONException;
import org.json.JSONObject;

import fi.foyt.cs.persistence.domainmodel.user.UserLocation;

public class UserLocationRenderer implements EntityRenderer<UserLocation> {

  @Override
  public JSONObject getAsJson(Locale locale, UserLocation userLocation) {
    JSONObject jsonObject = new JSONObject();

    try {
      jsonObject.put("latitude", userLocation.getLatitude());
      jsonObject.put("longitude", userLocation.getLongitude());
      jsonObject.put("updated", userLocation.getUpdated());
      
    } catch (JSONException e1) {
      throw new RenderingException(e1);
    }

    return jsonObject;
  }

}
